Skip to content

Three policy transport - #2

Merged
CodCodingCode merged 9 commits into
mainfrom
three-policy-transport
Aug 19, 2026
Merged

CodCodingCode merged 9 commits into
mainfrom
three-policy-transport

Conversation

@CodCodingCode

Copy link
Copy Markdown
Owner

No description provided.

CodCodingCode and others added 9 commits August 17, 2026 17:13
Checkpoints are the one binary artifact this repo commits on purpose (the
curated ones under snatch/checkpoints/; .gitignore excludes every other .pt).
At ~1.1 MB each for the current MLP they were tolerable as plain blobs, but
every future checkpoint permanently inflates every clone -- and the transport
lineage adds two more checkpoint families.

Tracks *.pt via LFS and renormalizes the ten committed checkpoints so the
current tree is LFS-backed. History is NOT rewritten: the old blobs still live
in past commits, so this bounds future growth rather than shrinking the repo
today. `git lfs migrate import --include="*.pt"` would reclaim that, at the cost
of a force-push over an already-merged PR.

Anyone cloning now needs git-lfs installed, or the checkpoints arrive as
pointer files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Splits the transport task into three policies, each its own checkpoint, each
warm-started from the one before: snatch (committed model_9250) -> carry ->
place. All three train in the SAME env against different success predicates,
which is what lets the gripper mean "close" in one stage and "open" in another.

env (--two_platform, off by default -- without it nothing here changes):
  - platform B, kinematic, re-posed per env at reset on a random bearing at the
    current curriculum separation. The goal stops being a waypoint over A and
    becomes the cube AT REST ON B's top.
  - _arrived  = held & cube over B (arrive_radius 0.30)  -> carry's success
  - _deposited = cube on B, settled, jaws open, NOT held -> place's success
    (--release_only). First predicate in this repo that requires ~_held; every
    prior "place" number was a still-gripped hover.
  - _update_sep: separation curriculum keyed on the STAGE'S OWN success, so the
    same code widens the gap on arrivals during carry and on deposits during
    place. Self-pacing, +0.25 m per gate at EMA 0.55.
  - long-haul shaping: tanh(d_goal) saturates flat metres out, so the potential
    term is rescaled to the current separation; carry_prog (a per-step delta) is
    scale-free and is what actually pulls the policy across the gap.
  - oob radius follows plat_sep_max, or the transit itself terminates as
    out-of-bounds the moment the gap exceeds the old 5 m default.

Also lands cfg.place_only + _place_reward (a gentle-deposit-only variant from an
already-holding start). Env-side only for now -- train_snatch.py does not expose
a flag for it yet, so it is unreachable from the CLI.

run_snatch_carry.sh / run_snatch_place.sh launch stages 2 and 3 with the venv,
the aarch64 LD_PRELOAD and a resume-from-latest restart loop. run_pipeline.py
runs all three end-to-end, switching policy per env on task state (three rsl_rl
runners, not three state_dicts -- each stage owns its observation normalizer).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ripts

This host has no conda and no `isaac` env -- Isaac Sim 5.1.0 / Isaac Lab 2.3.2 /
rsl_rl live in .venv311 (py3.11), gsplat in .venv (py3.10). Every docstring that
said `conda activate isaac; python ...` now says `.venv311/bin/python ...` with
the LD_PRELOAD of libgomp that this aarch64 host requires at import.

run_snatch_{grasp,nav,overhead,scoop}.sh are deleted rather than fixed: each
sourced the missing conda env, so `python` resolved to the system interpreter
and died on ModuleNotFoundError: isaaclab -- inside a restart loop, which
retried forever and looked alive in tmux while training nothing. Their
hyperparameters are preserved in the README's grasp-lineage section.

.gitignore: ignore the two venvs, which live in the tree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replays rollouts into Rerun, with --checkpoint repeatable so two or more
policies fly the same seeded episodes side by side and the difference between
lineage steps is visible rather than inferred from success rates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
THREE_POLICY.md is new: the process doc for the A->B transport lineage. Why the
task is split into three policies rather than one (credit assignment over a
600-step episode; snatch and place want opposite gripper commands; each stage
needs its own observation normalizer; the speed ladder only invalidates the
middle stage), the interface invariants all three must share, per-stage
contracts (what each is handed / its success predicate / what it hands on / the
gate that promotes it), the runtime handoff rules, the distance ladder, the eval
protocol and a failure-mode table.

It also records two things worth knowing before trusting a number:
  - the handoff in run_pipeline.py gates on ground-truth sim state (_held,
    _arrived), so pipeline results are an upper bound, not a deployable
    controller. Includes the observable replacements for both gates.
  - eval_snatch.py has no --two_platform/--release_only, so there is currently
    no honest per-stage eval for carry or place -- only training EMAs measured
    with carry demos on, which inflates them.

CLAUDE.md: venvs replace the conda instructions, GH200/aarch64 replaces the
stale A100 segfault note (what remains is a harmless Vulkan teardown segfault
AFTER checkpoints are written), disk warning updated, and the rule to always
hand back tail commands after launching a run.

README: leads with the pick-place demo, documents the SNATCH training recipe
with repo-relative paths, and adds the transport lineage section.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…hem there

Two new curated checkpoints complete the three-policy A->B transport chain
alongside the existing snatch expert (model_9250):

  carry_transport_21350.pt      stage 2, from drone_snatch_carry_v3 @ 21350
  place_deposit_throw_21950.pt  stage 3, from drone_snatch_place_only_v4 @ 21950

CARRY -- pure transport. --grip_closed welds a[4] to +1 every step so the policy
controls only [vx vy vz yaw_rate], which forces --carry_demo 1.0: with the jaws shut a
drone spawned away from the cube can never scoop it, so every env starts already
holding. Rationale: with the grasp in the loop arrive_rate plateaued at ~4% for 380
iterations, and most failures were the cube slipping mid-flight on a 49%-reliable
friction grasp, not bad flying. The action vector stays 5-wide so warm starts and the
3-policy runner still load; the 5th element is simply overridden.

PLACE -- the deposit trained in isolation (run_snatch_place_only.sh). Three fixes made
it learn at all:

  - _holding replaces _held for the approach/lower/seat/release terms. _held requires
    the cube above 0.385 but the seat pose puts it at 0.333, so _held went false for the
    last 5cm of the descent; gating on it paid the policy to hover 5cm short of the pad
    and made `seated` unreachable by construction. Judged geometrically instead.
  - release_latch (4 steps). Clearing release_jaw from the seated pose takes THREE
    consecutive a4=-1 steps (jaw 28.99 -> 24.39 -> 9.59 mm); with per-step independent
    Gaussian exploration that is p^3 = 2.6e-7, ~0.21 discoveries per iteration across
    2048 envs -- exactly the observed trickle (deposit_rate under display resolution for
    182 iterations). The latch turns a 3-step motor program into a 1-step decision.
  - terminate on cube-lost-at-rest rather than bleeding per-step. With a bleed, flying
    out of bounds to stop it outscores loitering (terminations aren't value-bootstrapped)
    and PPO found the exploit. Priced as a one-time fine instead.

Also for place: a competence-gated start ramp, so the spawn disc and altitude band
expand toward the full spec only as the deposit rate holds (a time-based anneal caused
catastrophic forgetting here before, a competence gate did not); a tapered descent cap
that reaches gentle_v over the last 10cm instead of the last cm; and _raw_actions kept
pre-clamp so _place_reward can tax out-of-range grip means -- measured +2.108 (sigma
0.282) on model_10900, putting a full release 8.17 sigma out, i.e. the release was not
"hard to explore", it was outside the support of the policy.

run_pipeline.py: rewrite the goal channel per phase, since each policy was trained with
a different meaning for obs[:, -3:] and feeding the snatch policy B's goal 2m away
collapses grasp to 0.1%; weld a[4] shut for the carry phase, whose 5th head is untrained
noise that can pop the cage open mid-haul; and accept both the 4- and 5-tuple env.step
signatures (Isaac Lab 2.3.2 / rsl_rl 3.1.2). Same tuple fix in eval_snatch.py.

New scripts: eval_place.py (deterministic place eval at full difficulty, start-ramp
off); film_place_rollout.py + film_snatch_rollout.py + film_place_draw.py (headless
physics -> npz -> matplotlib MP4, because vkCreateInstance fails on this host and the
RTX Camera sensor hangs env construction); render_place.py kept for a box with a working
Vulkan stack.

The A->B separation ladder is proportional now (~15% per rung): a fixed 0.25m increment
needed 34 gates to walk 1.5 -> 10m, each costing a dwell plus re-earning the EMA.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Vulkan works on this host after all. The 580.105.08 driver was a compute-only
install: CUDA present, but no loader, no ICD, no libGLX_nvidia, so every RTX
render died on ERROR_INCOMPATIBLE_DRIVER. Fixed on the box with

    apt-get install libnvidia-gl-580-server libvulkan1 vulkan-tools

NOT libnvidia-gl-580 -- that one's dry run removes libnvidia-compute-580-server
and swaps the driver to 580.119.02, which kills any training mid-run. The
-server variant matches the installed family and installs with zero removals.
vulkaninfo now reports the GH200 at API 1.4.312.

Rendering then still failed on the Isaac Lab 2.3.2 API drift already fixed in
eval_snatch/run_pipeline: get_observations() returns a bare TensorDict and
step() may return 5 values. render_snatch.py patched the same way.

run_pipeline.py -- the three-policy runner now actually runs:
  * obs normalizer restored by hand. rsl_rl 5.x stored it in a top-level
    obs_norm_state_dict; 3.1.2 deprecated empirical_normalization, moved
    normalization inside the policy, and its load() ignores that key -- so the
    weights loaded while the normalizer was silently dropped and the actor got
    RAW observations. That, not the policy, was model_9250 scoring 0% grasp in
    six different configs. With it restored: 82.7%, in line with the 87.4% on
    record. Only the old snatch checkpoint is affected; carry/place were saved
    by 3.1.2 and carry normalization inside their weights.
  * the goal channel means something different to each stage, so obs[:, -3:] is
    rewritten per phase: snatch was trained with the goal within +-0.25m of the
    CUBE, not 2m away at pad B.
  * _target[:, 2] is retargeted at the carry->place handoff (hover point 0.55m
    -> resting height 0.325m).
  * the carry policy's a[4] is untrained noise (it trained under --grip_closed),
    so the cage is welded shut for exactly that phase or it pops open mid-haul.
  * --trace_out records drone/cube/phase/pad-B geometry per step.

Measured end to end at 2m separation, 1617 episodes: grasp 83.8%, reach pad B
11.4%, deposit 0.6%. The loss is the snatch->carry handoff -- carry trained from
a tidy pre-seated pose and inherits a messy one here.

render_trace.py replays a recorded episode kinematically and renders it. At 0.6%
end-to-end, attaching a camera and hoping the followed env is a winner is not
practical; this writes the logged poses into the sim instead, so the motion is
exactly what the policies produced. --framing wide holds both pads in shot.

rrd_from_trace.py logs the same traces to Rerun .rrd (3D + scalar plots), for
scrubbing without Isaac. Note rerun-sdk must NOT go in .venv311 -- it drags in
numpy 2.x and breaks Isaac Sim's pins; use a throwaway venv.

Media: videos/delivery_env76.mp4 is one complete delivery (12.8s, 1280x720) --
fly in from 5.24m, grasp off pad A, carry 1.82m, deposit on pad B. The .rrd
files carry the same episodes plus three more.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both training runs stopped. Curated the checkpoints worth keeping into
snatch/checkpoints/ (the one path exempt from the *.pt ignore rule; they go to
LFS via .gitattributes) and trimmed logs into runs/.

  carry_8m_model_22800.pt        carry_v3 @ 22,800 -- 8.14 m, grasp 99.9%
  place_best_v4_model_21950.pt   place_v4 @ 21,950 -- deposit 90.2% (peak 92.7%)
  place_latest_v5_model_12500.pt place_v5 @ 12,500 -- deposit 42.8% (peak 57.5%)

v5 is the more recent place run but a REGRESSION -- it never cleared 57.5% where
v4 sat at ~90%. Kept so the attempt is not lost, but v4 is the one to use.

The carry run was mid-rung when stopped: it had cleared the 55% gate to reach
8.14 m and was re-earning it there (stalled ~46%, then slid to 31%). The last
distance it actually held 55% at was 7.08 m. Full ladder, 1.5 m -> 8.14 m over
11 advances, in runs/carry_v3_ladder.txt with per-rung iteration costs.

runs/README.md documents which checkpoint to use for what and how to resume --
including that SEP must be set to the last ladder value or the curriculum
restarts short, and that a stalled 8 m rung wants SPEED 1.5 -> 2.5 because
transit then eats ~5.4 s of an 18.7 s episode.

Full logs (19 MB + 2.6 MB) are not committed; runs/*.log.gz holds the last 4,000
lines of each, which covers the metrics history.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…licate

Deleted:
  place_latest_v5_model_12500.pt  -- place_only_v5 was the MORE RECENT place run
      but a regression: never cleared 57.5% deposit where v4 sat at ~90%. Its
      log is still in runs/place_v5_tail.log.gz.
  place_best_v4_model_21950.pt    -- byte-identical duplicate (same md5) of
      place_deposit_throw_21950.pt, which an earlier commit already saved.

Surviving per stage:
  carry_8m_model_22800.pt        8.14 m, grasp 99.9%
  place_deposit_throw_21950.pt   deposit 90.2% (peak 92.7%)

carry_transport_21350.pt is a genuinely different earlier snapshot (different
md5), so it stays.

runs/README.md notes what the surviving place policy actually does: 90% deposit
at impact_v 1.35 m/s and landing_err 10.4 cm -- it throws the cube down rather
than setting it gently, which is what "throw" in the filename records.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@CodCodingCode
CodCodingCode merged commit b65418d into main Aug 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant